package cn.edu.stu.syllabus.repository.library;

import java.util.List;

import javax.inject.Inject;

import cn.edu.stu.syllabus.repository.library.local.BookEntry;
import cn.edu.stu.syllabus.di.qualifier.Local;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import rx.Observable;

/**
 * Created by daidaijie on 2017/3/14.
 */

@FragmentScoped
public class BookStarDataRepository implements BookStarDataSource {

    BookStarDataSource mBookStarLocalDataSource;

    @Inject
    public BookStarDataRepository(@Local BookStarDataSource oaStarLocalDataSource) {
        mBookStarLocalDataSource = oaStarLocalDataSource;
    }

    @Override
    public void starBookEntry(BookEntry bookEntry) {
        mBookStarLocalDataSource.starBookEntry(bookEntry);
    }

    @Override
    public void unstarBookEntry(BookEntry bookEntry) {
        mBookStarLocalDataSource.unstarBookEntry(bookEntry);
    }

    @Override
    public boolean isExistEntry(BookEntry bookEntry) {
        return mBookStarLocalDataSource.isExistEntry(bookEntry);
    }

    @Override
    public Observable<List<BookEntry>> getStarBookEntries(long lastPosition, int pageNum) {
        return mBookStarLocalDataSource.getStarBookEntries(lastPosition, pageNum);
    }

}
